local mt = ac.skill['光环']
mt.art = [[ReplaceableTextures\CommandButtons\BTNDevotion.blp]]
mt.skill_type = 'passive'
mt.pulse = 0.25
mt.aura_time = 1            --维持时间
mt.aura_area = 900          --光环翻倍
mt.area_type = 'ally'       --敌人/友军/全部 enemy/ally/all
mt.aura_point = nil         --光环点
mt.buff_name = '光环效果'    --子效果名

function mt:on_add()
    local hero = self.owner
    self.buff_data = self.buff_data or {}
    self.buff_data.time = self.aura_time
    self.buff_data.source = hero
    if not self.selector then
        self.selector = ac.selector('unit'):range(self.aura_point or hero,self.aura_area)
        if self.area_type=='ally' then
            self.selector = self.selector:ally(hero)
        elseif self.area_type=='enemy' then
            self.selector = self.selector:enemy(hero)
        end
    end
	if self.model then
		self:gc(hero:add_effect(self.model,self.ref))
	end

    self:gc(self.pulse*1000,function()
        if self.selector and hero:is_alive() then
            for u in self.selector:loop() do
                local buff = u:find_buff(self.buff_name)
                if buff and buff:get_remaining()<self.aura_time then
                    buff:set_remaining(self.aura_time)
                else
                    u:add_buff(self.buff_name)(table.copy(self.buff_data))
                end
            end
        end
    end)
end

local buff = ac.buff['光环效果']
buff.art = [[ReplaceableTextures\CommandButtons\BTNDevotion.blp]]
buff.tip = [[该光环没有设置光环效果]]
buff.effect_data = {
    ['origin'] = [[Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl]]
}